/*class: DOMObject
 *
 *description:Basic class of all the other classes
 *with basic DOM function
 *parent:none
 *
 *version:0.2
 */

function DOMObject(id)
{
    /* public attr*/
    this.id = id;
}
/* public function */
DOMObject.prototype.$ = function()
{
   if(!this.id)
    {
	return null;
    }
    return document.getElementById(this.id);
}
DOMObject.prototype.removeThis = function()
{
    if(this.$())
    {
	this.$().parent.removeChild(this.$());
    }
}
DOMObject.prototype.hidenThis = function()
{
    if(this.$())
    {
	this.$().style.display = 'none';
    }
}
DOMObject.prototype.showThis = function()
{
    if(this.$())
    {
	this.$().style.display = 'block';
    }
}
// global public function
// create a HTML node
function WrapTag(tag,id,className,attr,innerHTML)
{
    if(!tag)
    {
	return null;
    }
    str = "<"+tag;
    if(id)
    {
	str+=" id='"+id+"'";
    }
    if(className)
    {
	str+=" class='"+className+"'";
    }
    if(attr)
	{
	    str+=" "+attr;
	}
    str+=">";
    if(innerHTML)
	str+=innerHTML;
    str+="</"+tag+">";
    return str;
}
